<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 引进mshare.js -->
  <script src="./js/myshare.js"></script>
  <script src="./js/jquery-3.4.1.js"></script>
</head>

<body>
  <button data-mshare="0">点击弹出原生分享面板</button>
  <button data-mshare="1">点击触发朋友圈分享</button>
  <button data-mshare="2">点击触发发送给微信朋友</button>
</body>

<script>
  var mshare = new mShare({ 
    title: '测试调用微信分享功能',
    url: 'https://image.baidu.com/search/index?tn=baiduimage&ct=201326592&lm=-1&cl=2&ie=gb18030&word=%CD%B7%CF%F1&fr=ala&oriquery=%E5%A4%B4%E5%83%8F&ala=1&alatpl=portait&pos=0',
    desc: '分享到微信',
    img: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1601013479907&di=2f016fa85d14f554e7a353fe28350bbe&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201712%2F19%2F20171219234358_VRdrH.thumb.700_0.jpeg'
  });
  $('button').click(function () {
    // 1 ==> 朋友圈  2 ==> 朋友  0 ==> 直接弹出原生
    mshare.init(+$(this).data('mshare'));
  });
</script>

</html>